MNDWI – Modified Normalized Difference Water Index
MNDWI is a spectral water index that enhances open surface water and suppresses
built-up areas, vegetation, and soil by combining the Green and SWIR bands.
It is widely used for water body mapping and flood monitoring in urban and rural environments.
1. Scientific Definition
The Modified Normalized Difference Water Index (MNDWI) was proposed by
Xu (2006) to improve the separation of open water bodies from built-up
land and vegetation. It replaces the Near-InfraRed band in NDWI with a
Short-Wave InfraRed (SWIR) band, which is strongly absorbed by water but
highly reflected by buildings, soil, and vegetation.
Moist soil, mixed pixels (land with some water signal)
0.0 – 0.2
Shallow or turbid water, narrow rivers, mixed shoreline pixels
> 0.2
Open and relatively deep surface water (lakes, reservoirs, wide rivers)
Key Applications
Extraction and mapping of surface water bodies (lakes, rivers, reservoirs).
Flood monitoring and delineation of inundated areas.
Urban water mapping and detection of ponds and canals.
Change detection of water extent over time (drought / seasonal variation).
2. Data & Bands for MNDWI
Common Sensors & Bands
Sentinel-2 (ESA) – 10 / 20 m
Green: B3 (~560 nm)
SWIR1: B11 (~1610 nm)
Landsat 8/9 OLI – 30 m
Green: B3
SWIR1: B6
Good Practice
Use atmospherically corrected surface reflectance products (e.g. COPERNICUS/S2_SR).
Apply cloud and cloud-shadow masking to avoid false positives over clouds.
Clip the final MNDWI raster to your Area of Interest (AOI) before exporting.
Use consistent dates or seasonal windows when comparing water extent over time.
Palette Suggestion
A typical water-focused color palette:
[ "#111827", "#1f2937", "#2563eb", "#38bdf8", "#e0f2fe" ]
3. Google Earth Engine Code – MNDWI for Any AOI
Steps: open code.earthengine.google.com → New Script → paste the code →
draw your AOI as geometry on the map → click Run.
Then export MNDWI as GeoTIFF to Google Drive.
// MNDWI for any Area of Interest (AOI) using Sentinel-2 SR
// -------------------------------------------------------
// 1) Go to: https://code.earthengine.google.com
// 2) Click "New Script" and paste this code.
// 3) On the map: draw your AOI (Polygon/Rectangle).
// It will appear as a variable named 'geometry' in the left panel.
// 4) Click "Run" to display MNDWI.
// 5) In the Tasks tab, click "Run" to export MNDWI to Google Drive.
// -------------------------------------------------------
// 1. Define Area of Interest (AOI)
// -------------------------------------------------------
var roi = geometry; // Make sure a 'geometry' object exists in the left panel
// Center the map on the AOI
Map.centerObject(roi, 11);
// -------------------------------------------------------
// 2. Define time range
// -------------------------------------------------------
var startDate = '2023-01-01';
var endDate = '2023-12-31';
// -------------------------------------------------------
// 3. Load Sentinel-2 Surface Reflectance collection
// and keep only bands needed for MNDWI
// -------------------------------------------------------
var s2 = ee.ImageCollection('COPERNICUS/S2_SR')
.filterBounds(roi)
.filterDate(startDate, endDate)
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20))
.select(['B3', 'B11']); // Green, SWIR1
// Create a median composite and clip to AOI
var image = s2.median().clip(roi);
// -------------------------------------------------------
// 4. Compute MNDWI
// MNDWI = (Green - SWIR1) / (Green + SWIR1)
// -------------------------------------------------------
var mndwi = image.normalizedDifference(['B3', 'B11']).rename('MNDWI');
// -------------------------------------------------------
// 5. Visualization on the map
// -------------------------------------------------------
var mndwiVis = {
min: -1,
max: 1,
palette: [
'#111827', // very low (built-up / vegetation)
'#1f2937',
'#2563eb',
'#38bdf8',
'#e0f2fe' // high (open water)
]
};
// Add MNDWI layer to the map
Map.addLayer(mndwi, mndwiVis, 'MNDWI (Sentinel-2)', true);
// Optionally, also show a true color composite for context
var s2_rgb = ee.ImageCollection('COPERNICUS/S2_SR')
.filterBounds(roi)
.filterDate(startDate, endDate)
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20))
.select(['B4','B3','B2']) // RGB
.median()
.clip(roi);
Map.addLayer(s2_rgb, {min:0, max:3000}, 'True Color (RGB)', false);
// -------------------------------------------------------
// 6. Export MNDWI as GeoTIFF to Google Drive
// -------------------------------------------------------
Export.image.toDrive({
image: mndwi,
description: 'MNDWI_Export',
fileNamePrefix: 'MNDWI_Export',
region: roi,
scale: 10, // Sentinel-2 resolution
crs: 'EPSG:4326',
maxPixels: 1e13
});
// End of script